<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/layouts/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>图册管理</title>
    <%@include file="/WEB-INF/layouts/index-header.jsp" %>
</head>
<body>

<div class="tpanel">
    <div class="panel-content">
        <div class="container-fluid">
            <div id="tool">
                <form id="searchForm" class="form-inline" onsubmit="return search('#searchForm','#table')" style="margin-top:20px;margin-bottom:20px;">
                    <div class="form-group">
                        <a class="btn btn-success radius" href="${ctx}/admin/cms/album/create">
                            <span class="glyphicon glyphicon-cog"></span> 创建
                        </a>
                    </div>
                </form>
            </div>
            <table id="table"></table>
        </div>
    </div>
</div>

<script type="text/javascript">
    window.parent.changeTitle('图册管理');

    $(function () {
        $('.form_datetime').datetimepicker({
            language: 'zh-CN',
            autoclose: true
        });
        $('#table').bootstrapTable({
            url: '${ctx}/admin/cms/album/page-list',
            idField: 'id',
            striped: true,
            pagination: true,
            pageNumber: 1,
            pageSize: 25,
            sidePagination: 'server',
            uniqueId: 'id',
            queryParams: queryParams,
            responseHandler: responseHandler,
            columns: [{
                title: '#',
                width: 50,
                align: 'center',
                formatter: snFormatter
            },
                {
                    field: 'name',
                    title: '图册名称',
                    align: 'center'
                },
                {
                    field: 'catalogName',
                    title: '图册分类',
                    align: 'center'
                },
                {
                    title: '图片数量',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return row.pictureCount;
                    }
                },
                {
                    field: 'op',
                    title: '操作',
                    align: 'center',
                    formatter: operateFormatter
                }]
        });

    });

    function del(id, name) {
        carefulDelete('${ctx}/admin/cms/album/careful-delete', id, '请输入您的管理密码以确定删除此系统资源');
    }

    function operateFormatter(value, row, index) {
        var content = '<a title="查看详情" href="javascript:detail(' + row.id + ')"><i class="iconfont icon-caidanguanli"></i></a>';
        content += '&nbsp;&nbsp;&nbsp;&nbsp;';
        content += '<a href="${ctx}/admin/cms/album/update?id=' + row.id + '" title="编辑"><i class="iconfont icon-iconfontcolor32"></i></a>';
        content += '&nbsp;&nbsp;&nbsp;&nbsp;';
        content += '<a href="javascript:del(' + row.id + ')" title="删除"><i class="iconfont icon-shanchu"></i></a>';
        return content;
    }

    function detail(id) {
        openWindow('查看详情', '${ctx}/admin/cms/album/detail?id=' + id);
    }
</script>

</body>
</html>
